<!--
数据源-全局数据源
-->
<template>
  <div>
    <el-form v-model="dataSource" label-width="100px">
      <el-form-item label="全局数据源">
        <el-select clearable
                   v-model="form.dataKey"
                   filterable
                   placeholder="">
          <el-option
            v-for="item in globalDataSourceList"
            :key="item.uuid"
            :label="item.dataKey"
            :value="item.dataKey">
          </el-option>
        </el-select>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
  import dataLoader from "./dataLoader";
  import vpd from '../../designer/mixins/vpd';

  export default {
    name: 'vpd-ds-globalData',
    mixins: [vpd],
    title: '全局数据源',
    dataLoader: dataLoader,
    props: {
      dataSource: {
        type: Object
      }
    },
    data() {
      return {
        form: {
          dataKey: undefined
        }
      }
    },
    computed: {
      globalDataSourceList() {
        return this.$vpd.state.dataSources;
      }
    },
    beforeMount() {
      Object.assign(this.form, this.dataSource);
    },
    methods: {
      getForm() {
        return this.form;
      },
    },

  }
</script>
